package com.corejsf;

import java.util.Properties;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
/**
 * 
 * Used to retrieve configurations file in various beans.
 * @author Kelton Kowalchuk
 *
 */
@Named("configurations")
@ApplicationScoped
public class Configurations implements Serializable {
    private Properties config;
    /**
     * Constructor for the Configurations class
     */
    Configurations(){
        config = new Properties();
        try {
             config.load(this.getClass().getResourceAsStream("configurations.properties"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            
            e.printStackTrace();
        }
    }

    /**
     * Gets the value associated with the parameter key
     * @param option_key
     * @return the matching value associated with option_key
     */
    public String getConfig(String option_key) {
        return config.getProperty(option_key);
    }
    
}
